3 * MediaWiki is the to-be base class for this whole project
12 * Stores parameters (to avoid using globals)
14 function setVal( $key, &$value ) {
15 $this->param
[strtolower( $key )] = $value;
19 * Retrieves parameters
21 function getVal( $key, $default = "" ) {
22 $key = strtolower( $key );
23 if( isset( $this->params
[$key] ) ) {
24 return $this->params
[$key];
30 * Creates the article to be known as $wgArticle
32 function initializeArticle( &$title, &$request, $action ) {
33 // Fix Media namespace
34 if( NS_MEDIA
== $title->getNamespace() ) {
35 $title = Title
::makeTitle( NS_IMAGE
, $title->getDBkey() );
38 $ns = $title->getNamespace();
40 // Namespace might change when using redirects
41 $article = new Article( $title );
42 if($action == 'view' && !$request->getVal( 'oldid' ) ) {
43 $rTitle = Title
::newFromRedirect( $article->fetchContent() );
45 # Reload from the page pointed to later
46 $article->mContentLoaded
= false;
47 $ns = $rTitle->getNamespace();
48 $wasRedirected = true;
52 // Categories and images are handled by a different class
53 if( $ns == NS_IMAGE
) {
54 $b4 = $title->getPrefixedText();
56 require_once( 'includes/ImagePage.php' );
57 $article = new ImagePage( $title );
58 if( isset( $wasRedirected ) ) {
59 $article->mTitle
= $rTitle;
60 $article->mRedirectedFrom
= $b4;
62 } elseif( $ns == NS_CATEGORY
) {
64 require_once( 'includes/CategoryPage.php' );
65 $article = new CategoryPage( $title );
71 * Performs any of a wide range of passed actions
73 function performAction( $action, &$output, &$article, &$title, &$user, &$request ) {
76 $output->setSquidMaxage( $this->getVal('SquidMaxage') );
90 case 'deletetrackback':
98 if( !$this->getVal('EnableDublinCoreRdf') ) {
99 wfHttpError( 403, 'Forbidden', wfMsg( 'nodublincore' ) );
101 require_once( 'includes/Metadata.php' );
102 wfDublinCoreRdf( $article );
105 case 'creativecommons':
106 if( !$this->getVal('EnableCreativeCommonsRdf') ) {
107 wfHttpError( 403, 'Forbidden', wfMsg('nocreativecommons') );
109 require_once( 'includes/Metadata.php' );
110 wfCreativeCommonsRdf( $article );
114 require_once( 'includes/Credits.php' );
115 showCreditsPage( $article );
118 if( !$this->getVal('CommandLineMode') && !$request->checkSessionCookie() ) {
119 # Send a cookie so anons get talk message notifications
120 User
::SetupSession();
124 $internal = $request->getVal( 'internaledit' );
125 $external = $request->getVal( 'externaledit' );
126 $section = $request->getVal( 'section' );
127 $oldid = $request->getVal( 'oldid' );
128 if(!$this->getVal('UseExternalEditor') ||
$action=='submit' ||
$internal ||
129 $section ||
$oldid ||
(!$user->getOption('externaleditor') && !$external)) {
130 require_once( 'includes/EditPage.php' );
131 $editor = new EditPage( $article );
133 } elseif($this->getVal('UseExternalEditor') &&($external ||
$user->getOption('externaleditor'))) {
134 require_once( 'includes/ExternalEdit.php' );
135 $mode = $request->getVal( 'mode' );
136 $extedit = new ExternalEdit( $article, $mode );
141 if($_SERVER['REQUEST_URI'] == $title->getInternalURL('action=history')) {
142 $output->setSquidMaxage( $this->getVal('SquidMaxage') );
144 require_once( 'includes/PageHistory.php' );
145 $history = new PageHistory( $article );
149 require_once( 'includes/RawPage.php' );
150 $raw = new RawPage( $article );
154 if(wfRunHooks('UnknownAction', array($action, $article))) {
155 $output->errorpage( 'nosuchaction', 'nosuchactiontext' );
160 }; # End of class MediaWiki